package com.aoxon.cargo.component;

import android.app.ProgressDialog;
import android.content.Context;


/**
 * 	添加显示进度框
 * @author ZZJ
 *
 */
public class MyProgressDialog {

	private ProgressDialog m_pDialog;
	private boolean cancelable = false;
	
	public MyProgressDialog(Context context){
		m_pDialog = new ProgressDialog(context);
	}
	
	public MyProgressDialog(Context context, boolean cancelable){
		this.cancelable = cancelable;
		m_pDialog = new ProgressDialog(context);
	}
	
	
	/**
	 * 显示进度框
	 * @param strTitle
	 * @param strMessage
	 */
	public void show(String strTitle, String strMessage){
		try {
			m_pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
			m_pDialog.setMax(150);
			m_pDialog.setTitle(strTitle);
			m_pDialog.setMessage(strMessage);
			m_pDialog.setIndeterminate(false);
			m_pDialog.setCancelable(cancelable);
			m_pDialog.show();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * 关闭进度框
	 */
	public void cancle(){
		m_pDialog.cancel();
	}
	
	public void dismiss() {
		m_pDialog.dismiss();
	}
}
